<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
	</head>
	<body>
		<p>请输入体重kg</p>
			<input type="text" name="kg" id="kg"/>
		<p>请输入身高</p>
		<input type="text" name="cm" id="cm" />
		<p>
			<input type="button" name="js" id="js" value="计算"onclick="js()" />
		</p>
		<p id="result"></p>
		<script >
			function js(){
				var weight=document.getElementById('kg');
				var height=document.getElementById('cm');
				var result=document.getElementById('js');
				var h=height.value/100;
				var w=weight.value;
				bim=w/(h*h).toFixed(2);
	
					result.innerHTML=bim;
				
		
			}
		</script>
	</body>
</html>
